package com.esri.core.internal.tasks.d;

import com.esri.core.geometry.SpatialReference;
import com.esri.core.geometry.Unit;
import com.esri.core.tasks.na.AttributeParameterValue;
import com.esri.core.tasks.na.NAFeatures;
import com.esri.core.tasks.na.NAOutputLine;
import com.esri.core.tasks.na.UTurnRestriction;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public abstract class c extends com.esri.core.internal.tasks.f {
    private static final long serialVersionUID = 1;
    protected NAFeatures a = null;
    protected NAFeatures b = null;
    protected NAFeatures c = null;
    protected AttributeParameterValue[] d = null;
    protected boolean e = false;
    protected boolean f = false;
    protected boolean g = false;
    protected SpatialReference h = null;
    protected NAOutputLine i = null;
    protected String[] j = null;
    protected String k = null;
    protected String[] l = null;
    protected UTurnRestriction m = null;
    protected Boolean n = null;
    protected Double o = null;
    protected Unit.EsriUnit p = Unit.EsriUnit.UNKNOWN;
    protected boolean q = false;

    @Override // com.esri.core.internal.tasks.f
    public boolean validate() {
        return true;
    }

    public NAFeatures q() {
        return this.a;
    }

    public void c(NAFeatures nAFeatures) {
        this.a = nAFeatures;
    }

    public NAFeatures r() {
        return this.b;
    }

    public void d(NAFeatures nAFeatures) {
        this.b = nAFeatures;
    }

    public NAFeatures s() {
        return this.c;
    }

    public void e(NAFeatures nAFeatures) {
        this.c = nAFeatures;
    }

    public AttributeParameterValue[] t() {
        return this.d;
    }

    public void a(AttributeParameterValue[] attributeParameterValueArr) {
        this.d = attributeParameterValueArr;
    }

    public boolean u() {
        return this.e;
    }

    public void e(boolean z) {
        this.e = z;
    }

    public boolean v() {
        return this.f;
    }

    public void f(boolean z) {
        this.f = z;
    }

    public boolean w() {
        return this.g;
    }

    public void g(boolean z) {
        this.g = z;
    }

    public SpatialReference x() {
        return this.h;
    }

    public void a(SpatialReference spatialReference) {
        this.h = spatialReference;
    }

    public NAOutputLine y() {
        return this.i;
    }

    public void a(NAOutputLine nAOutputLine) {
        this.i = nAOutputLine;
    }

    public String[] z() {
        return this.j;
    }

    public void a(String[] strArr) {
        this.j = strArr;
    }

    public String A() {
        return this.k;
    }

    public void d(String str) {
        this.k = str;
    }

    public String[] B() {
        return this.l;
    }

    public void b(String[] strArr) {
        this.l = strArr;
    }

    public UTurnRestriction C() {
        return this.m;
    }

    public void a(UTurnRestriction uTurnRestriction) {
        this.m = uTurnRestriction;
    }

    public Boolean D() {
        return this.n;
    }

    public void a(Boolean bool) {
        this.n = bool;
    }

    public Double E() {
        return this.o;
    }

    public void b(Double d) {
        this.o = d;
    }

    public Unit.EsriUnit F() {
        return this.p;
    }

    public void a(Unit.EsriUnit esriUnit) {
        this.p = esriUnit;
    }

    public boolean G() {
        return this.q;
    }

    public void h(boolean z) {
        this.q = z;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public Map<String, String> H() throws Exception {
        AttributeParameterValue[] attributeParameterValueArr;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        NAFeatures nAFeatures = this.a;
        if (nAFeatures != null) {
            linkedHashMap.put("barriers", nAFeatures.toJson());
        }
        NAFeatures nAFeatures2 = this.b;
        if (nAFeatures2 != null) {
            linkedHashMap.put("polylineBarriers", nAFeatures2.toJson());
        }
        NAFeatures nAFeatures3 = this.c;
        if (nAFeatures3 != null) {
            linkedHashMap.put("polygonBarriers", nAFeatures3.toJson());
        }
        if (this.d != null) {
            StringWriter stringWriter = new StringWriter();
            JsonGenerator a = com.esri.core.internal.util.d.a(stringWriter);
            a.writeStartArray();
            for (AttributeParameterValue attributeParameterValue : this.d) {
                if (attributeParameterValue != null) {
                    a.writeStartObject();
                    a.writeStringField("attributeName", attributeParameterValue.getAttributeName());
                    a.writeStringField("parameterName", attributeParameterValue.getParameterName());
                    a.writeStringField("value", attributeParameterValue.getValue());
                    a.writeEndObject();
                }
            }
            a.writeEndArray();
            a.close();
            linkedHashMap.put("attributeParameterValues", stringWriter.toString());
        }
        linkedHashMap.put("returnBarriers", Boolean.toString(this.e));
        linkedHashMap.put("returnPolylineBarriers", Boolean.toString(this.f));
        linkedHashMap.put("returnPolygonBarriers", Boolean.toString(this.g));
        SpatialReference spatialReference = this.h;
        if (spatialReference != null) {
            linkedHashMap.put("outSR", Integer.toString(spatialReference.getID()));
        }
        String[] strArr = this.j;
        if (strArr != null && strArr.length > 0) {
            linkedHashMap.put("accumulateAttributeNames", com.esri.core.internal.util.a.a(strArr, ","));
        }
        String str = this.k;
        if (str != null && str.length() > 0) {
            linkedHashMap.put("impedanceAttributeName", this.k);
        }
        String[] strArr2 = this.l;
        if (strArr2 != null && strArr2.length > 0) {
            linkedHashMap.put("restrictionAttributeNames", com.esri.core.internal.util.a.a(strArr2, ","));
        }
        UTurnRestriction uTurnRestriction = this.m;
        if (uTurnRestriction != null) {
            linkedHashMap.put("restrictUTurns", uTurnRestriction.toString());
        }
        Boolean bool = this.n;
        if (bool != null) {
            linkedHashMap.put("useHierarchy", bool.toString());
        }
        Double d = this.o;
        if (d != null) {
            linkedHashMap.put("outputGeometryPrecision", d.toString());
        }
        linkedHashMap.put("outputGeometryPrecisionUnits", this.p.toString());
        linkedHashMap.put("returnZ", Boolean.toString(this.q));
        return linkedHashMap;
    }

    public static String[] b(JsonParser jsonParser) throws Exception {
        ArrayList arrayList = new ArrayList();
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                arrayList.add(jsonParser.getText());
            }
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        return (String[]) arrayList.toArray(new String[arrayList.size()]);
    }

    public static Double[] c(JsonParser jsonParser) throws Exception {
        ArrayList arrayList = new ArrayList();
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                arrayList.add(Double.valueOf(jsonParser.getDoubleValue()));
            }
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        return (Double[]) arrayList.toArray(new Double[arrayList.size()]);
    }
}
